<template>
	<view>
		<baseForm :column.sync="column" @submitFun="submitFun" :submitStatus="submitDisable" :button="button">
			<view class="normalInput">
				<text v-text="telObj.label"></text>
				<input
					class="uni-input"
					placeholder-class="input-placeholder"
					:value="telObj.value"
					:placeholder="`请填写${telObj.label}`"
					:disabled="telObj.disabled"
					:name="telObj.name"
					@input="change"
				/>
				<view class="copyBtn" @click="copyTel" v-show="telObj.value">点击复制</view>
			</view>
			<view class="normalInput" v-if="parentTelObj.value">
				<text v-text="parentTelObj.label"></text>
				<input
					class="uni-input"
					placeholder-class="input-placeholder"
					:value="parentTelObj.value"
					:placeholder="`请填写${parentTelObj.label}`"
					:disabled="parentTelObj.disabled"
					:name="parentTelObj.name"
					@input="change"
				/>
				<view class="copyBtn" @click="copyTel" v-show="parentTelObj.value">点击复制</view>
			</view>
		</baseForm>
		
	</view>
</template>

<script>
import baseForm from '@/wxcomponents/form/form.vue';
import formMixins from '@/libs/formMixins.js';
export default {
	mixins: [formMixins],
	data() {
		let that = this;
		return {
			itemData: '',
			button: {
				hide: true
			},
			
			isParent: '',
			telObj: {
				label: '手机号',
				name: 'mobilePhone',
				type: 'normalInput',
				disabled: true,
				required: false,
				value: null
			},
			parentTelObj: {
				label: '家长手机号',
				name: 'mobilePhone',
				type: 'normalInput',
				disabled: true,
				required: false,
				value: null
			},
			column: [
				{
					label: '姓名',
					name: 'name',
					type: 'normalInput',
					disabled: true,
					required: false,
					value: '姓名'
				},
				{
					label: '学号',
					name: 'number',
					type: 'normalInput',
					disabled: true,
					required: false,
					value: '学号'
				},
				{
					label: '专业',
					name: 'majorName',
					type: 'normalInput',
					disabled: true,
					required: false,
					value: '专业'
				},
				{
					label: '年级',
					name: 'grade',
					type: 'normalInput',
					disabled: true,
					required: false,
					value: '年级'
				},
				{
					label: '班级',
					name: 'className',
					type: 'normalInput',
					disabled: true,
					required: false,
					value: '班级'
				}
				// {
				// 	label: '手机号',
				// 	name: 'phone',
				// 	type: 'normalInput',
				// 	disabled: true,
				// 	required: false,
				// 	value: '手机号'
				// },
				// {
				// 	label: '家长手机号',
				// 	name: 'memberOnePhone',
				// 	type: 'normalInput',
				// 	disabled: true,
				// 	required: false,
				// 	value: '家长手机号'
				// }
			]
		};
	},
	async onLoad(option) {
		this.assignFormDataToViewModel(JSON.parse(option.data), this.column);
		this.isParent = JSON.parse(option.data).isParent;
		// JSON.parse(option.data)
		// this.column[5].hidden = this.isParent;
		// this.column[6].hidden = !this.isParent;
		this.telObj.value = JSON.parse(option.data).phone;
		this.parentTelObj.value = JSON.parse(option.data).memberOnePhone;
	},
	methods: {
		copyTel() {
			uni.setClipboardData({
				data: this.telObj.value,
				success(res) {
					// uni.hideToast();
				},
				fail(e) {}
			});
		},
		async getDetail() {
			let resp = await this.$http.get({
				url: `/oa/sealApply/detail/${this.itemData.id}`
			});
			this.assignFormDataToViewModel(resp.result, this.column);
		}
	},
	components: {
		baseForm
	},
	watch: {}
};
</script>

<style lang="scss" scoped>

.normalInput {
	border-bottom: 1upx solid #eee;
	margin: 0 50upx;
	// height: 100upx;
	position: relative;
	text {
		display: block;
		text-align: left;
		font-size: 28upx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		margin-top: 20upx;
		// padding: 0 10upx;
	}
	input {
		line-height: 80upx;
		height: 80upx;
		padding: 0 10upx;
		font-size: 32upx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
	}
}
.copyBtn {
	position: absolute;
	right: 20upx;
	padding: 10upx;
	border: 1upx solid #007aff;
	border-radius: 10upx;
	font-size: 24upx;
	color: #999;
	bottom: 20upx;
	z-index: 5;
}
</style>
